function table(config) {
	var width,height,row,column;
	var rows = [],columns=[];
	if(config.grid) {
		width = config.grid.width;
		height = config.grid.height;
		row = config.grid.row;
		column = config.grid.column;
		const rowHeight = height/row;
		const columnWidth = width/column;
		const table = document.createElement("div");
		table.style.width=width+"px";
		table.style.height=height+"px";
		table.style.position="relative";
		
		for(var i=0;i<row;i++) {
			const tr = document.createElement("div");
			for(var j=0;j<column;j++) {
				const td = document.createElement("div");
				tr.appendChild(td);
				td.style.width=(columnWidth-2)+"px";
				td.style.height=(rowHeight-2)+"px";
				td.style.position="absolute"
				td.style.left=j*(columnWidth)+"px";
				if(config.grid.style.td) {
					td.setAttribute("class", config.grid.style.td.class[0]);
				}
				columns.push(td);
			}
			table.appendChild(tr);
			
			tr.style.width=width+"px";
			tr.style.height=rowHeight+"px";
			tr.style.position="relative"
			if(config.grid.style.tr) {
				const index = i%(config.grid.style.tr.class.length);
				tr.setAttribute("class", config.grid.style.tr.class[index]);
			}
			rows.push(tr);
		}
		
		if(config.grid.container) {
			const dom = document.getElementById(config.grid.container);
			dom.appendChild(table);
			table.id = config.grid.id;
			table.rows = rows;
			table.columns = columns;
			table.config = config;
			Comm.push(table);
			return table;
		}
	}
	
}

(function($) {
	var content = [];
	var Comm = {table:$,push:glob};
	
	function load(data,fn) {
		const id = this.id;
		const colen = this.config.grid.column;
		content.push({id:data});
		console.info(data);
		
		for(var i=0;i<data.length;i++) {
			var row = this.rows[i];
			
			for(var j=0;j<data[i].length;j++) {
				
				var column = this.columns[i*colen+j];
				
				fn(row,column,data[i][j]);
			}
		}
	}
	
	function glob(table) {
		table.load = load;
	}
	
	if(window.Comm) {
		Comm.table = $;
		Comm.push = glob;
	}else {
		window.Comm = Comm;
	}
})(table);